package cn.wen.forum.vo;

import cn.wen.forum.pojo.entity.Review;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.List;

/**
 * @ClassName ReviewVO
 * @Author By wen
 * @Description
 * @Date 2023/3/14 16:50
 * @Version 1.0
 */
@Data
public class ReviewVO extends Review {

    @JsonFormat
    private String timeStr;

    /**
     * 当前评论的头像路径
     */
    private String headPortrait;

    /**
     * 上级父评论的用户名
     */
    private String parentUserName;

    /**
     * 上级父评论内容
     */
    private String parentReview;
    /**
     * 所回复父评论的头像
     */
    private Long parentUserId;
    /**
     * 论坛等级
     */
    private Integer level;
    /**
     * 经验值
     */
    private Integer empiricalValue;
    /**
     * 是否管理员
     */
    private Integer adminiStrator;
    /**
     * 论坛等级str
     *
     */
    private String levelStr;
    /**
     * 当前评论的子评论
     */
    private List<ReviewVO> sonReviewList;

    public ReviewVO() {
    }

    public ReviewVO(Review review) {
        super.setId(review.getId());
        super.setPostId(review.getPostId());
        super.setUserId(review.getUserId());
        super.setParentId(review.getParentId());
        super.setUserName(review.getUserName());
        super.setReview(review.getReview());
        super.setReviewApproval(review.getReviewApproval());
        super.setTime(review.getTime());
    }

    public void setReview(Review review){
        super.setId(review.getId());
        super.setPostId(review.getPostId());
        super.setUserId(review.getUserId());
        super.setParentId(review.getParentId());
        super.setReview(review.getReview());
        super.setReviewApproval(review.getReviewApproval());
        super.setTime(review.getTime());
    }
}
